#pragma strict

var offset:Vector2; //当前的偏移值
var speed:Vector2 = Vector2.one; //偏移速度
var textureName:String = "_MainTex";
var isRun:boolean; //要偏移?

private var curRenderer:Renderer;
private var mat:Material;

function Start () {
	curRenderer = renderer;
	mat = curRenderer.sharedMaterial;
}

function Update () {
	if(isRun){
		offset.x += Time.deltaTime * speed.x;
		offset.y += Time.deltaTime * speed.y;
		
		mat.SetTextureOffset(textureName,offset);
	}
}